const { verify } = require('jsonwebtoken');
const Router = require('koa-router');

const { verifyAuth, veriPermission } = require('../middleware/auto.middleware');
const { create, reply, update,remove,list } = require('../controller/comment.controller');

const commentRouter = new Router({ prefix: '/comment' });

//发表评论
commentRouter.post('/', verifyAuth, create);
commentRouter.post('/:commentId/reply', verifyAuth, reply);

//修改评论
commentRouter.patch('/:commentId', verifyAuth, veriPermission, update);
//删除评论
commentRouter.delete('/:commentId',verifyAuth, veriPermission,remove);

//获取评论
commentRouter.get('/',list)

module.exports = commentRouter;
